package icu.which.strongchild.common;

import icu.which.strongchild.exception.BusinessException;

/**
 * 返回工具类
 *
 * @author which
 */
public class ResultUtils {

    public static <T> BaseResponse<T> success(T data){
        return new BaseResponse<>(200,data,"OK");
    }

    public static BaseResponse error(ErrorCode errorCode){
        return new BaseResponse(errorCode);
    }

    public static BaseResponse error(BusinessException e){
        return new BaseResponse(e.getCode(),null,e.getMessage());
    }


}
